package com.gzhryc.shared_device.common.payment.dao.db;

import com.gzhryc.common.NumberTools;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.DateBranchTable;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.jdbc.enums.DateBranchTableType;
import com.gzhryc.pay.enums.TradeType;
import com.gzhryc.pay.models.IPayOrder;
import com.gzhryc.shared_device.base.enums.EPayState;
import com.gzhryc.shared_device.base.enums.EPayType;
import com.gzhryc.shared_device.common.payment.dao.enums.AlipayConfigEnum;

import java.util.Date;

/**
 * 微信支付订单
 * @version 2022-11-07
 */
@DateBranchTable(type = DateBranchTableType.year)
@Table(name="payment_ali_pay_order")
public class AlipayOrder implements IPayOrder {

    private static final long serialVersionUID = 1L;

	@Id(auto = false)
    @Column(name = "trade_no", length = 32,notNull = true, note = "支付订单号")
    protected String tradeNo;

    @Column
    protected String title;

    @Column(length = 255, note = "订单描述")
    protected String note;

    @Column(name = "business_type",notNull = true,  note = "业务类型")
    protected String businessType;
    
    @Column(name = "business_type_name",notNull = true,  note = "业务类型")
    protected String businessTypeName;

    @Column(name = "business_trade_no", length = 32, notNull = true, note = "业务订单号")
    protected String businessTradeNo;

    @Column(name = "external_trade_no", length = 64, note = "第三方支付订单编号")
    protected String externalTradeNo;

    @Column(name = "app_type", notNull = true, note = "应用类型")
    protected Integer appType;

    @Column(name = "app_id", notNull = true, note = "应用ID")
    protected String appId;

    @Column(name = "payer_id", length = 64,notNull = true, note = "第三方支付的用户ID")
    protected String payerId;

    @Column(name = "business_account", length = 64,notNull = true, note = "商户账号")
    protected String businessAccount;

    @Column(name = "trade_type", notNull = true,note = "订单类型，normal:普通订单，支付分订单")
    protected String tradeType;

    @Column(name = "pay_money", notNull = true,defVal = "0",note = "支付金额")
    protected Integer payMoney;

    @Column(name = "receipt_money", notNull = true,defVal = "0",note = "实收金额")
    protected Integer receiptMoney;

    @Column(name = "client_ip", note = "终端IP")
    protected String clientIP;

    @Column(name = "external_content", type = "TEXT", note = "第三方支付订单内容")
    protected String externalContent;
    
    @Column(name = "notify_url", length = 255, note = "支付回调路径")
    protected String notifyUrl;

    @Column(name = "pay_date", note = "支付时间")
    protected Date payDate;

    @Column(name = "pay_status", notNull = true,defVal = "1",note = "支付状态")
    protected Integer payStatus;

    @Column(name = "fail_note", length = 255, note = "失败描述")
    protected String failNote;

    @Column(name = "update_date", note = "修改时间", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date", note = "创建时间")
    protected Date createDate;

    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getBusinessTypeName() {
		return businessTypeName;
	}

	public void setBusinessTypeName(String businessTypeName) {
		this.businessTypeName = businessTypeName;
	}

	public String getBusinessTradeNo() {
        return businessTradeNo;
    }

    public void setBusinessTradeNo(String businessTradeNo) {
        this.businessTradeNo = businessTradeNo;
    }

    public String getExternalTradeNo() {
        return externalTradeNo;
    }

    public void setExternalTradeNo(String externalTradeNo) {
        this.externalTradeNo = externalTradeNo;
    }

    public Integer getAppType() {
        return appType;
    }

    public void setAppType(Integer appType) {
        this.appType = appType;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getPayerId() {
        return payerId;
    }

    public void setPayerId(String payerId) {
        this.payerId = payerId;
    }

    public String getBusinessAccount() {
        return businessAccount;
    }

    public void setBusinessAccount(String businessAccount) {
        this.businessAccount = businessAccount;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public Integer getPayMoney() {
        return payMoney;
    }

    public void setPayMoney(Integer payMoney) {
        this.payMoney = payMoney;
    }

    public Integer getReceiptMoney() {
        return receiptMoney;
    }

    public void setReceiptMoney(Integer receiptMoney) {
        this.receiptMoney = receiptMoney;
    }

    public String getClientIP() {
        return clientIP;
    }

    public void setClientIP(String clientIP) {
        this.clientIP = clientIP;
    }

    public String getNotifyUrl() {
		return notifyUrl;
	}

	public void setNotifyUrl(String notifyUrl) {
		this.notifyUrl = notifyUrl;
	}

	public String getExternalContent() {
        return externalContent;
    }

    public void setExternalContent(String externalContent) {
        this.externalContent = externalContent;
    }

    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }

    public Integer getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }

    public String getFailNote() {
        return failNote;
    }

    public void setFailNote(String failNote) {
        this.failNote = failNote;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getTradeTypeName(){
        return TradeType.note(this.tradeType);
    }

    public String getPayStatusName(){
        return EPayState.note(this.payStatus);
    }

    public String getPayMoneyStr(){
        return NumberTools.getMoneyStr(this.payMoney);
    }

    public String getReceiptMoneyStr(){
        return NumberTools.getMoneyStr(this.receiptMoney);
    }

    public String getAppTypeName(){
        return AlipayConfigEnum.AppType.note(this.appType);
    }
    
    public String getPayTypeName() {
    	return EPayType.Alipay.note();
    }
}
